package com.solarStruggle.apps;

import java.io.{File}
import javax.imageio.{ImageIO}
import scala.swing.{SimpleGUIApplication}
import controls.{MainScreen}
import domain.SolarSystemImageGenerator
import graphics.{SSLookAndFeel}

object SolarStruggle
extends SimpleGUIApplication {

/*  val sky = new StarrySkyGenerator(1024).createImage
  val planetSeed = new ProceduralImageGenerator(1146, 1280, Color.BLACK, 64) {
    val descriptor = RandomColorDescriptor(ColorSpec(new Color(192, 128, 64), ColorSpec.VaryBy(0.25f), ColorSpec.VaryBy(0.25f), ColorSpec.Invariant))
    val r = new Random
    override def renderPixel(image: BufferedImage, x: Int, y: Int) {
      image.setPixel(x, y, descriptor.getColor(r))
    }
  }.createImage
  
  val flatPlanet = new DiamondSquare(64, ColorSpec(Color.WHITE, ColorSpec.VaryBy(0.01f), ColorSpec.VaryBy(0.03f), ColorSpec.Invariant), planetSeed).createImage
  val mapImage = new MetaBallGenerator(1146, 1280, new Color(0, 0, 0, 0), 1, 1, 300, new Point(500, 500) :: Nil) {
      def colorFunction(value: Float): Color = new Color(value, value, value, 1.0f)
    }.createImage
    
  val multiplierImage = new ProceduralImageGenerator(mapImage.getWidth, mapImage.getHeight, Color.BLACK) {
    override def renderPixel(image: BufferedImage, x: Int, y: Int) {
      val c = mapImage.getPixel(x, y)
      image.setPixel(x, y, new Color(c.getRed, c.getGreen, c.getBlue, 255))
    }
  }.createImage
  
  val planet = new MultiplicativeImageCombiner(
    new WrappedImageGenerator(flatPlanet, mapImage, 120, new Color(0, 0, 0, 0), 1).createImage, 
    multiplierImage).createImage
  val scene = new LayeredImageGenerator(sky :: planet :: Nil).createImage*/
  
  def top = new MainScreen {
		
    new SSLookAndFeel().register()
		
	}
	
	ImageIO.write(new SolarSystemImageGenerator(1280, 1024).createImage(), "png", new File("/home/matt/ss.png"));
      
}
